package com.hxexp.weixin.test;

import java.util.Arrays;

import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

import com.hxexp.weixin.common.cache.CalendarCacheManager;
import com.hxexp.weixin.test.runner.JUnit4WithSpringLogClassRunner;

import static org.junit.Assert.assertArrayEquals;

/**
 * 日历缓存类测试
 *
 * @author li.jiang
 *
 */
@RunWith(JUnit4WithSpringLogClassRunner.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@ContextConfiguration(locations = { "classpath:conf/spring/spring-biz.xml", "classpath:conf/spring/spring-ehcache.xml" })
public class CalendarCacheManagerTester {

    @Autowired
    private CalendarCacheManager calendarCacheManager;

    @Test
    public void testCase01() {
        String[][] expect = { { "", "", "1", "2", "3", "4", "5" }, { "6", "7", "8", "9", "10", "11", "12" },
                { "13", "14", "15", "16", "17", "18", "19" }, { "20", "21", "22", "23", "24", "25", "26" },
                { "27", "28", "29", "30", "31", "", "" } };
        String[][] returnValue = calendarCacheManager.getCalendarArray(2016, 3);
        System.out.println(Arrays.toString(returnValue));
        assertArrayEquals(expect, returnValue);
    }
}
